package com.ofr.controller.user;


import com.ofr.ejb.dao.DonationDao;
import com.ofr.ejb.dao.UserDao;
import com.ofr.ejb.entities.Donation;
import com.ofr.ejb.entities.User;
import com.ofr.qualifiers.CurrentSession;
import com.ofr.session.UserSession;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: imon
 * Date: 2/23/13
 * Time: 11:35 AM
 * To change this template use File | Settings | File Templates.
 */
@Named
@RequestScoped
public class MyContributionController {

    private List<Donation> userDonationList;

    @Inject
    @CurrentSession
    UserSession userSession;

    @EJB
    DonationDao donationDao;

    public List<Donation> getUserDonationList() {
        userDonationList = donationDao.getDonationListByUserID(userSession.getUser().getUserId());
        return userDonationList;
    }

    public void setUserDonationList(List<Donation> userDonationList) {
        this.userDonationList = userDonationList;
    }

    @PostConstruct
    public void init() {
    }


}
